package everything;

public class Flag {
	int _x,_y,_value;
	final int _defaultValue = 10;
	int _owner = 0;

	public Flag(int x, int y, int value){
		_x = x;
		_y = y;
		_value = value;
	}

	public Flag(int x, int y){
		_x = x;
		_y = y;
		_value = _defaultValue;;
	}

	public int getX() {
		return _x;
	}

	public int getY() {
		return _y;
	}

	public int getValue() {
		return _value;
	}


	public boolean isLocatedIn(int x, int y){
		return _x == x && _y == y;
	}

	public void SetValue(int val){
		_value = val;
	}

	// returns distance of flag from given point
	public int getDistance (int x, int y){
		return (Math.abs(x-_x) + Math.abs(y - _y));
	}

	public boolean isFree(){
		return _owner == 0;
	}

	public void setOwner(int owner) {
		_owner = owner;
	}

	public int getOwner() {
		return _owner;
	}
}
